Skip to content

fix: add tests for raw RSA keyring node #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2019

Conversation

seebees
Copy link
Contributor

@seebees seebees commented Jul 9, 2019

Adding tests for raw RSA Keyring node

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@seebees seebees requested a review from a team July 9, 2019 01:48
})

it('Precondition: RsaKeyringNode needs identifying information for encrypt and decrypt.', () => {
// @ts-ignore Typescript is trying to save us.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is typescript saving us from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript knows that this function should be called with a keyNamespace and a keyName, so it will complain. But JS does not have this protection... So to test that this will indeed throw, I need TypeScript to be quite and not complain about calling the function incorrectly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

const suite = new NodeAlgorithmSuite(AlgorithmSuiteIdentifier.ALG_AES256_GCM_IV12_TAG16_HKDF_SHA256)
const material = new NodeEncryptionMaterial(suite)
const test = await keyring.onEncrypt(material)
expect(test.hasValidKey()).to.equal(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this compare the type that is returned to be true? Or will any true value returned from this function pass this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.chaijs.com/api/bdd/#method_equal

it is === . The issue is that the udk should be random, so there is not too much to test. Given that I pull the udk below maybe this has no value.
Want me to pull it out?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No i was trying to understand JS a little better.

@seebees seebees merged commit eb4813e into aws:master Jul 9, 2019
@seebees seebees deleted the raw_ras_keyring_node-tests branch July 9, 2019 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants